<%@page contentType="text/html; charset=utf-8"%>
<%@ include file="../inc/TagLibs.jsp"%>
<c:set var="pageTitle" value="业务明细一览表" />
<c:if test="${currentUser.user.userType==1 || fn:indexOf(currentUser.privs,';NO_BUSI_COST;')==-1}">
	<c:set var="showCost" value="1" />
</c:if>
<%@ include file="../inc/Title.jsp"%>
<head>
<link href="/css/Query.css" rel="stylesheet" type="text/css">
<link href="/calendar/dhtmlgoodies_calendar/dhtmlgoodies_calendar.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" type="text/css" href="/css/BillList.css" />
<script src="/js/QueryList.js"></script>
<script src="/js/popup_ext.js"></script>
<script src="/calendar/dhtmlgoodies_calendar/dhtmlgoodies_calendar.js"></script>
<script language="javascript">
	function checkDateStr(){
		var startDate=document.getElementById("start_date").value;
		if(startDate==null || startDate==''){
			ShowAlert('提示框','请选择订货开始日期',200,100);
			return false;
		}else{
			var arr=startDate.split("-");
			if(arr.length==null || arr.length!=3){
				ShowAlert('提示框','订货开始日期格式不正确',200,100);
				return false;
			}else if(isNaN(arr[0]) || isNaN(arr[1]) || isNaN(arr[2])){
				ShowAlert('提示框','订货开始日期格式不正确',200,100);
				return false;
			}
		}
		var endDate=document.getElementById("end_date").value;
		if(endDate==null || endDate==''){
			ShowAlert('提示框','请选择订货结束日期',200,100);
			return false;
		}else{
			var arr=endDate.split("-");
			if(arr.length==null || arr.length!=3){
				ShowAlert('提示框','订货结束日期格式不正确',200,100);
				return false;
			}else if(isNaN(arr[0]) || isNaN(arr[1]) || isNaN(arr[2])){
				ShowAlert('提示框','订货结束日期格式不正确',200,100);
				return false;
			}
		}
		return true;
	}
	function checkDelDateStr(){
		var startDate=document.getElementById("del_start").value;
		if(startDate==null || startDate==''){
			ShowAlert('提示框','请选择交货开始日期',200,100);
			return false;
		}else{
			var arr=startDate.split("-");
			if(arr.length==null || arr.length!=3){
				ShowAlert('提示框','交货开始日期格式不正确',200,100);
				return false;
			}else if(isNaN(arr[0]) || isNaN(arr[1]) || isNaN(arr[2])){
				ShowAlert('提示框','交货开始日期格式不正确',200,100);
				return false;
			}
		}
		var endDate=document.getElementById("del_end").value;
		if(endDate==null || endDate==''){
			ShowAlert('提示框','请选择交货结束日期',200,100);
			return false;
		}else{
			var arr=endDate.split("-");
			if(arr.length==null || arr.length!=3){
				ShowAlert('提示框','交货结束日期格式不正确',200,100);
				return false;
			}else if(isNaN(arr[0]) || isNaN(arr[1]) || isNaN(arr[2])){
				ShowAlert('提示框','交货结束日期格式不正确',200,100);
				return false;
			}
		}
		return true;
	}
	function createPageParaStr(){
		var str="start_date="+encodeURIComponent(document.getElementById("start_date").value);
		str=str+"&end_date="+encodeURIComponent(document.getElementById("end_date").value);
		
		var examined="A";
		if(document.getElementById("examine1").checked){
			examined="Y";
		}else if(document.getElementById("examine2").checked){
			examined="N";
		}
		str=str+"&examined="+examined;
		
		var completed="A";
		if(document.getElementById("complete1").checked){
			completed="Y";
		}else if(document.getElementById("complete2").checked){
			completed="N";
		}
		str=str+"&completed="+completed;
		
		var delivered="A";
		if(document.getElementById("deliver1").checked){
			delivered="Y";
		}else if(document.getElementById("deliver2").checked){
			delivered="P";
		}else if(document.getElementById("deliver3").checked){
			delivered="N";
		}
		str=str+"&delivered="+delivered;
		
		var closed="A";
		if(document.getElementById("close1").checked){
			closed="Y";
		}else if(document.getElementById("close2").checked){
			closed="N";
		}
		str=str+"&closed="+closed;
		
		var coop="A";
		if(document.getElementById("cooper1").checked){
			coop="Y";
		}else if(document.getElementById("cooper2").checked){
			coop="N";
		}
		str=str+"&coop="+coop;
		
		var pric="A";
		if(document.getElementById("pric1").checked){
			pric="NOT_ZERO";
		}else if(document.getElementById("pric2").checked){
			pric="ZERO";
		}
		str=str+"&pric="+pric;
		
		var coll="A";
		if(document.getElementById("coll1").checked){
			coll="Y";
		}else if(document.getElementById("coll2").checked){
			coll="N";
		}
		str=str+"&coll="+coll;
		
		var pr="A";
		if(document.getElementById("pr1").checked){
			pr="AREA";
		}else if(document.getElementById("pr2").checked){
			pr="LENGTH";
		}else if(document.getElementById("pr3").checked){
			pr="AMOUNT";
		}
		str=str+"&pr="+pr;
		
		str=str+"&del_start="+encodeURIComponent(document.getElementById("del_start").value);
		str=str+"&del_end="+encodeURIComponent(document.getElementById("del_end").value);
		str=str+"&mng_name="+encodeURIComponent(document.getElementById("mng_name").value);
		str=str+"&est_id="+document.getElementById("est_id").value;
		str=str+"&est_name="+encodeURIComponent(document.getElementById("est_name").value);
		str=str+"&linkman="+encodeURIComponent(document.getElementById("linkman").value);
		str=str+"&phone="+encodeURIComponent(document.getElementById("phone").value);
		str=str+"&bill_code="+encodeURIComponent(document.getElementById("bill_code").value);
		str=str+"&cont_code="+encodeURIComponent(document.getElementById("cont_code").value);
		str=str+"&bb_cont="+encodeURIComponent(document.getElementById("bb_cont").value);
		str=str+"&department="+document.getElementById("department").value;
		str=str+"&min_cost="+encodeURIComponent(document.getElementById("min_cost").value.trim());
		str=str+"&max_cost="+encodeURIComponent(document.getElementById("max_cost").value.trim());
		str=str+"&desi_name="+encodeURIComponent(document.getElementById("desi_name").value);
		str=str+"&foll_name="+encodeURIComponent(document.getElementById("foll_name").value);
		str=str+"&intr_name="+encodeURIComponent(document.getElementById("intr_name").value);
		str=str+"&crea_name="+encodeURIComponent(document.getElementById("crea_name").value);
		str=str+"&make_type="+document.getElementById("make_type").value;
		str=str+"&content="+encodeURIComponent(document.getElementById("content").value);
		str=str+"&require="+encodeURIComponent(document.getElementById("require").value);
		str=str+"&area="+document.getElementById("area").value;
		str=str+"&est_type="+document.getElementById("est_type").value;
		str=str+"&est_level="+document.getElementById("est_level").value;
		str=str+"&ts_id="+document.getElementById("ts_id").value;
		str=str+"&order_by="+document.getElementById("order_by").value;
		str=str+"&order_sc="+document.getElementById("order_sc").value;
		str=str+"&product="+encodeURIComponent(document.getElementById("product").value);
		str=str+"&wc="+document.getElementById("wc").value;
		str=str+"&wp="+document.getElementById("wp").value;
		return str;
	}
	
	function createProgramParaStr(){
		var str="start_date="+encodeURIComponent(document.getElementById("hid_start_date").value);
		str=str+"&end_date="+encodeURIComponent(document.getElementById("hid_end_date").value);
		str=str+"&examined=${examined}";
		str=str+"&completed=${completed}";
		str=str+"&delivered=${delivered}";
		str=str+"&closed=${closed}";
		str=str+"&coop=${coop}";
		str=str+"&pric=${pric}";
		str=str+"&coll=${coll}";
		str=str+"&pr=${pr}";
		str=str+"&del_start="+encodeURIComponent(document.getElementById("hid_del_start").value);
		str=str+"&del_end="+encodeURIComponent(document.getElementById("hid_del_end").value);
		str=str+"&mng_name="+encodeURIComponent(document.getElementById("hid_mng_name").value);
		str=str+"&est_id=${estId}";
		str=str+"&est_name="+encodeURIComponent(document.getElementById("hid_est_name").value);
		str=str+"&linkman="+encodeURIComponent(document.getElementById("hid_linkman").value);
		str=str+"&phone="+encodeURIComponent(document.getElementById("hid_phone").value);
		str=str+"&bill_code="+encodeURIComponent(document.getElementById("hid_bill_code").value);
		str=str+"&cont_code="+encodeURIComponent(document.getElementById("hid_cont_code").value);
		str=str+"&bb_cont="+encodeURIComponent(document.getElementById("hid_bb_cont").value);
		str=str+"&department=${department}";
		str=str+"&min_cost="+encodeURIComponent(document.getElementById("hid_min_cost").value);
		str=str+"&max_cost="+encodeURIComponent(document.getElementById("hid_max_cost").value);
		str=str+"&desi_name="+encodeURIComponent(document.getElementById("hid_desi_name").value);
		str=str+"&foll_name="+encodeURIComponent(document.getElementById("hid_foll_name").value);
		str=str+"&intr_name="+encodeURIComponent(document.getElementById("hid_intr_name").value);
		str=str+"&crea_name="+encodeURIComponent(document.getElementById("hid_crea_name").value);
		str=str+"&make_type=${makeType}";
		str=str+"&content="+encodeURIComponent(document.getElementById("hid_content").value);
		str=str+"&require="+encodeURIComponent(document.getElementById("hid_require").value);
		str=str+"&area=${area}";
		str=str+"&est_type=${estType}";
		str=str+"&est_level=${estLevel}";
		str=str+"&ts_id=${tsId}";
		str=str+"&order_by=${orderBy}";
		str=str+"&order_sc=${orderSc}";
		str=str+"&product="+encodeURIComponent(document.getElementById("hid_product").value);
		str=str+"&wc=${wc}";
		str=str+"&wp=${wp}";
		return str;
	}

	function doSearch(){
		var str;
		if(IsAdvSearch){//高级
			str="search_type=1";
			if(document.getElementById("cb_order_date").checked){
				if(checkDateStr()){
					str=str+"&cb_order_date=1";
				}else{
					return;
				}
			}
			if(document.getElementById("cb_del_date").checked){
				if(checkDelDateStr()){
					str=str+"&cb_del_date=1";
				}else{
					return;
				}
			}
			if(document.getElementById("cb_examine").checked){
				str=str+"&cb_examine=1";
			}
			if(document.getElementById("cb_complete").checked){
				str=str+"&cb_complete=1";
			}
			if(document.getElementById("cb_deliver").checked){
				str=str+"&cb_deliver=1";
			}
			if(document.getElementById("cb_close").checked){
				str=str+"&cb_close=1";
			}
			if(document.getElementById("cb_coop").checked){
				str=str+"&cb_coop=1";
			}
			if(document.getElementById("cb_pric").checked){
				str=str+"&cb_pric=1";
			}
			if(document.getElementById("cb_coll").checked){
				str=str+"&cb_coll=1";
			}
			if(document.getElementById("cb_pr").checked){
				str=str+"&cb_pr=1";
			}
			if(document.getElementById("cb_mng").checked){
				var mngName=document.getElementById("mng_name").value.trim();
				if(mngName==null || mngName==""){
					ShowAlert('提示框','请输入业务员姓名',200,100);
					return;
				}
				str=str+"&cb_mng=1";
			}
			if(document.getElementById("cb_desi").checked){
				var desiName=document.getElementById("desi_name").value.trim();
				if(desiName==null || desiName==""){
					ShowAlert('提示框','请输入设计员姓名',200,100);
					return;
				}
				str=str+"&cb_desi=1";
			}
			if(document.getElementById("cb_foll").checked){
				var follName=document.getElementById("foll_name").value.trim();
				if(follName==null || follName==""){
					ShowAlert('提示框','请输入跟单人姓名',200,100);
					return;
				}
				str=str+"&cb_foll=1";
			}
			if(document.getElementById("cb_intr").checked){
				var intrName=document.getElementById("intr_name").value.trim();
				if(intrName==null || intrName==""){
					ShowAlert('提示框','请输入业务来源',200,100);
					return;
				}
				str=str+"&cb_intr=1";
			}
			if(document.getElementById("cb_crea").checked){
				var creaName=document.getElementById("crea_name").value.trim();
				if(creaName==null || creaName==""){
					ShowAlert('提示框','请输入开单人姓名',200,100);
					return;
				}
				str=str+"&cb_crea=1";
			}
			if(document.getElementById("cb_est").checked){
				var estName=document.getElementById("est_name").value;
				if(estName==null || estName==""){
					ShowAlert('提示框','请选择订货单位',200,100);
					return;
				}
				str=str+"&cb_est=1";
			}
			if(document.getElementById("cb_linkman").checked){
				var linkman=document.getElementById("linkman").value.trim();
				if(linkman==null || linkman==""){
					ShowAlert('提示框','请输入联系人',200,100);
					return;
				}
				str=str+"&cb_linkman=1";
			}
			if(document.getElementById("cb_phone").checked){
				var phone=document.getElementById("phone").value.trim();
				if(phone==null || phone==""){
					ShowAlert('提示框','请输入电话',200,100);
					return;
				}
				str=str+"&cb_phone=1";
			}
			if(document.getElementById("cb_bill_code").checked){
				var billCode=document.getElementById("bill_code").value.trim();
				if(billCode==null || billCode==""){
					ShowAlert('提示框','请输入业务单号',200,100);
					return;
				}
				str=str+"&cb_bill_code=1";
			}
			if(document.getElementById("cb_cont_code").checked){
				var contCode=document.getElementById("cont_code").value.trim();
				if(contCode==null || contCode==""){
					ShowAlert('提示框','请输入合同号',200,100);
					return;
				}
				str=str+"&cb_cont_code=1";
			}
			if(document.getElementById("cb_bb_cont").checked){
				var bbCont=document.getElementById("bb_cont").value.trim();
				if(bbCont==null || bbCont==""){
					ShowAlert('提示框','请输入摘要',200,100);
					return;
				}
				str=str+"&cb_bb_cont=1";
			}
			if(document.getElementById("cb_dep").checked){
				var department=document.getElementById("department").value;
				if(department==null || department=="" || department=="0"){
					ShowAlert('提示框','请选择部门',200,100);
					return;
				}
				str=str+"&cb_dep=1";
			}
			if(document.getElementById("cb_wc").checked){
			   var wc=document.getElementById("wc").value;
			   if(wc==null || wc==""){
			      ShowAlert('提示框','请选择工作中心',200,100);
			      return;
			   }
			   str=str+"&cb_wc=1";
			}
			if(document.getElementById("cb_cost").checked){
				var minCost=document.getElementById("min_cost").value.trim();
				if(minCost==null || minCost==""){
					ShowAlert('提示框','请输入最小金额',200,100);
					return;
				}else if(isNaN(minCost)){
					ShowAlert('提示框','最小金额只能是数字',200,100);
					return;
				}
				var maxCost=document.getElementById("max_cost").value.trim();
				if(maxCost==null || maxCost==""){
					ShowAlert('提示框','请输入最大金额',200,100);
					return;
				}else if(isNaN(maxCost)){
					ShowAlert('提示框','最大金额只能是数字',200,100);
					return;
				}
				str=str+"&cb_cost=1";
			}
			if(document.getElementById("cb_make_type").checked){
				var makeType=document.getElementById("make_type").value;
				if(makeType==null || makeType=="" || makeType=="0"){
					ShowAlert('提示框','请选择项目类型',200,100);
					return;
				}
				str=str+"&cb_make_type=1";
			}
			if(document.getElementById("cb_product").checked){
			   //var product=document.getElementById("product").value.trim();
			   //if(product==null || product==""){
			   //   ShowAlert('提示框','请输入材质',200,100);
			   //   return;
			   //}
			   str=str+"&cb_product=1";
			}
			if(document.getElementById("cb_content").checked){
				var content=document.getElementById("content").value.trim();
				if(content==null || content==""){
					ShowAlert('提示框','请输入内容',200,100);
					return;
				}
				str=str+"&cb_content=1";
			}
			if(document.getElementById("cb_require").checked){
				var require=document.getElementById("require").value.trim();
				if(require==null || require==""){
					ShowAlert('提示框','请输入制作要求',200,100);
					return;
				}
				str=str+"&cb_require=1";
			}
			if(document.getElementById("cb_area").checked){
				var area=document.getElementById("area").value;
				if(area==null || area=="" || area=="0"){
					ShowAlert('提示框','请选择地区',200,100);
					return;
				}
				str=str+"&cb_area=1";
			}
			if(document.getElementById("cb_est_type").checked){
				var estType=document.getElementById("est_type").value;
				if(estType==null || estType=="" || estType=="0"){
					ShowAlert('提示框','请选择客户类别',200,100);
					return;
				}
				str=str+"&cb_est_type=1";
			}
			if(document.getElementById("cb_est_level").checked){
				var estLevel=document.getElementById("est_level").value;
				if(estLevel==null || estLevel=="" || estLevel=="0"){
					ShowAlert('提示框','请选择客户等级',200,100);
					return;
				}
				str=str+"&cb_est_level=1";
			}
			if(document.getElementById("cb_ts").checked){
				var tsId=document.getElementById("ts_id").value;
				if(tsId==null || tsId=="" || tsId=="0"){
					ShowAlert('提示框','请选择帐套',200,100);
					return;
				}
				str=str+"&cb_ts=1";
			}
			if(document.getElementById("cb_wp").checked){
			   var wp=document.getElementById("wp").value;
			   if(wp==null || wp==""){
			      ShowAlert('提示框','请选择生产进度',200,100);
			      return;
			   }
			   str=str+"&cb_wp=1";
			}
			if(document.getElementById("cb_order").checked){
				var orderBy=document.getElementById("order_by").value;
				if(orderBy==null || orderBy==""){
					ShowAlert('提示框','请选择排序类型',200,100);
					return;
				}
				str=str+"&cb_order=1";
			}
		}else{//快速
			str="search_type=2";
			if(!checkDateStr()){
				return;
			}
		}
		var paraStr=createPageParaStr();
		if(paraStr!=""){
			str=str+"&"+paraStr;
		}
		window.location="/business/BusinessBillItemSearchResult.ihtm?"+str;
	}
	function doGo(pageIndex){
		var str=getSearchCondition();
		str=str+"&current_page="+pageIndex;
		window.location="/business/BusinessBillItemSearchResult.ihtm?"+str;
	}
	function getSearchCondition(){
		var searchType="${searchType}";
		var str="search_type="+searchType;
		if(searchType=="1"){//高级
			<c:if test="${cbOrderDate=='1'}">str=str+"&cb_order_date=1";</c:if>
			<c:if test="${cbExamine=='1'}">str=str+"&cb_examine=1";</c:if>
			<c:if test="${cbComplete=='1'}">str=str+"&cb_complete=1";</c:if>
			<c:if test="${cbDeliver=='1'}">str=str+"&cb_deliver=1";</c:if>
			<c:if test="${cbClose=='1'}">str=str+"&cb_close=1";</c:if>
			<c:if test="${cbCoop=='1'}">str=str+"&cb_coop=1";</c:if>
			<c:if test="${cbPric=='1'}">str=str+"&cb_pric=1";</c:if>
			<c:if test="${cbDelDate=='1'}">str=str+"&cb_del_date=1";</c:if>
			<c:if test="${cbMng=='1'}">str=str+"&cb_mng=1";</c:if>
			<c:if test="${cbEst=='1'}">str=str+"&cb_est=1";</c:if>
			<c:if test="${cbLinkman=='1'}">str=str+"&cb_linkman=1";</c:if>
			<c:if test="${cbPhone=='1'}">str=str+"&cb_phone=1";</c:if>
			<c:if test="${cbBillCode=='1'}">str=str+"&cb_bill_code=1";</c:if>
			<c:if test="${cbContCode=='1'}">str=str+"&cb_cont_code=1";</c:if>
			<c:if test="${cbBbCont=='1'}">str=str+"&cb_bb_cont=1";</c:if>
			<c:if test="${cbDep=='1'}">str=str+"&cb_dep=1";</c:if>
			<c:if test="${cbCost=='1'}">str=str+"&cb_cost=1";</c:if>
			<c:if test="${cbDesi=='1'}">str=str+"&cb_desi=1";</c:if>
			<c:if test="${cbFoll=='1'}">str=str+"&cb_foll=1";</c:if>
			<c:if test="${cbIntr=='1'}">str=str+"&cb_intr=1";</c:if>
			<c:if test="${cbCrea=='1'}">str=str+"&cb_crea=1";</c:if>
			<c:if test="${cbMakeType=='1'}">str=str+"&cb_make_type=1";</c:if>
			<c:if test="${cbContent=='1'}">str=str+"&cb_content=1";</c:if>
			<c:if test="${cbRequire=='1'}">str=str+"&cb_require=1";</c:if>
			<c:if test="${cbArea=='1'}">str=str+"&cb_area=1";</c:if>
			<c:if test="${cbEstType=='1'}">str=str+"&cb_est_type=1";</c:if>
			<c:if test="${cbEstLevel=='1'}">str=str+"&cb_est_level=1";</c:if>
			<c:if test="${cbTs=='1'}">str=str+"&cb_ts=1";</c:if>
			<c:if test="${cbOrder=='1'}">str=str+"&cb_order=1";</c:if>
			<c:if test="${cbProduct=='1'}">str=str+"&cb_product=1";</c:if>
			<c:if test="${cbWc=='1'}">str=str+"&cb_wc=1"</c:if>
			<c:if test="${cbColl=='1'}">str=str+"&cb_coll=1"</c:if>
			<c:if test="${cbPr=='1'}">str=str+"&cb_pr=1"</c:if>
			<c:if test="${cbWp=='1'}">str=str+"&cb_wp=1"</c:if>
		}else{//快速
			
		}
		
		var paraStr=createProgramParaStr();
		if(paraStr!=""){
			str=str+"&"+paraStr;
		}
		
		return str;
	}
	function doJump(pageIndex){
		if(window.event.keyCode==13){
			doGo(pageIndex);
		}
	}
	function DoubleClick(id){
		<c:if test="${currentUser.user.userType==1 || fn:indexOf(currentUser.privs,';BUSI_MODI;')!=-1}">
			var url="/business/BusinessBillEdit.ihtm?id="+id+"&edit_type=MODIFY";
			ShowIframe("业务单",url,1024,600,"refreshWin()");
		</c:if>
	}
	function refreshWin(){
		if(popRetVal!=null){
			window.location.reload(true);
		}
	}
	<c:if test="${showCost=='1'}">
	function doDownload(){
		var str=getSearchCondition();
		window.location="/business/BusinessBillItemSearchResult.ihtm?content_type=EXCEL&"+str;
	}
	</c:if>
	function doCancel(){
		window.close();
	}
	function doInit(){
		Window_Onload();
		if(window.screen.availWidth>1024){
			var w=window.screen.availWidth*0.98;
			window.resizeTo(w,600);
			//居中
			var resizeWinTop=(window.screen.availHeight-600)/2;
			var resizeWinLeft=(window.screen.availWidth-w)/2;
			window.moveTo(resizeWinLeft,resizeWinTop);
		}
	}
	function checkInput(){
		if(window.event.keyCode==13){
			doSearch();
		}
	}
	function doAutoCheck(objId){
		document.getElementById(objId).checked=true;
	}
	function selectStafferName(objId,checkObjId){
		var url="/base/StafferMainForSelect.ihtm";
		ShowIframe("选择员工",url,800,500,"selectStafferNameCallBack('"+objId+"','"+checkObjId+"')");
	}
	function selectStafferNameCallBack(objId,checkObjId){
		if(popRetVal!=null){
			var arr=popRetVal.split(";");
			document.getElementById(objId).value=arr[1];
			doAutoCheck(checkObjId);
		}
	}
	function setDate(type){
		var d=new Date();
		var startStr="";
		var endStr="";
		if(type=="CURRENT_MONTH"){
			startStr=d.getFullYear()+"-"+(d.getMonth()+1)+"-01";
			endStr=d.getFullYear()+"-"+(d.getMonth()+1)+"-"+d.getDate();
		}else if(type=="PREVIEW_MONTH"){
			d=new Date(d.getFullYear(),d.getMonth(),1);
			d.setDate(d.getDate()-1);
			startStr=d.getFullYear()+"-"+(d.getMonth()+1)+"-1";
			endStr=d.getFullYear()+"-"+(d.getMonth()+1)+"-"+d.getDate();
		}else if(type=="TODAY"){
			startStr=d.getFullYear()+"-"+(d.getMonth()+1)+"-"+d.getDate();
			endStr=d.getFullYear()+"-"+(d.getMonth()+1)+"-"+d.getDate();
		}else if(type=="YESTERDAY"){
			d.setDate(d.getDate()-1);
			startStr=d.getFullYear()+"-"+(d.getMonth()+1)+"-"+d.getDate();
			endStr=d.getFullYear()+"-"+(d.getMonth()+1)+"-"+d.getDate();
		}
		document.getElementById("start_date").value=startStr;
		document.getElementById("end_date").value=endStr;
		doAutoCheck("cb_order_date");
	}
	function selectEstName(){
		var url="/base/EstablishmentListForSelect.ihtm?type=CLIENT";
		ShowIframe("选择客户",url,900,500,"selectEstNameCallBack()");
	}
	function selectEstNameCallBack(){
		if(popRetVal!=null){
			document.getElementById("est_id").value=popRetVal[0];
			document.getElementById("est_name").value=popRetVal[1];
			doAutoCheck("cb_est");
		}
	}
	function doWcChange(){
		var proSele=document.getElementById("wp");
		proSele.options.length=0;//删除所有选项
		var opt=document.createElement("option");
		opt.setAttribute("value","0");
		if(checkNavigator()[0]!="msie"){
			opt.innerText="==请选择==";
		}else{
			opt.text="==请选择==";
			//opt.setAttribute("text","==请选择==");//ie
		}
		try{
			proSele.options.add(opt,null);
		}catch(ex){
			proSele.options.add(opt);//ie
		}
		var wc=document.getElementById("wc").value;
		if(wc!="" && wc!="0"){
			var xmlHttp=createXMLHttpRequest();
			xmlHttp.open("GET", "/base/GetWorkCenterProcess.ihtm?wc_id="+wc,true);
			xmlHttp.onreadystatechange = function(){
				if (xmlHttp.readyState == 4) {
		      		if (xmlHttp.status == 200) {
						var arr=xmlHttp.responseXML.getElementsByTagName("process");
						if(arr.length>0){
							for(var i=0;i<arr.length;i++){
								var children=arr[i].childNodes;
								var proId="0";
								var proName="";
								for(var j=0;j<children.length;j++){
									if(children[j].tagName=="id"){
										proId=children[j].firstChild.data;
									}else if(children[j].tagName=="proName"){
										proName=children[j].firstChild.data;
									}
								}
								opt=document.createElement("option");
								opt.setAttribute("value",proId);
								if(checkNavigator()[0]!="msie"){
									opt.innerText=proName;
								}else{
									opt.text=proName;
									//opt.setAttribute("text",proName);//ie
								}
								try{
									proSele.add(opt,null);
								}catch(ex){
									proSele.add(opt);//ie
								}
							}
						}
					}
				}
			};
			xmlHttp.send(null);
		}
	}
	function showList(type){
		var str="search_type=1&cb_ts=1&ts_id=DF_TS_ID";
		if(type=='ZERO_PRIC'){
			str=str+"&cb_pric=1&pric=ZERO";
		}else{
			return;
		}
		window.location="/business/BusinessBillItemSearchResult.ihtm?"+str;
	}
</script>
</head>
<body oncontextmenu="return false">
<div class="Wrap"> <!-- 页面主框架 -->
    
	<div id="ListContainer" class="Container"><!-- 主体容器 -->
	    
	    <!-- 标题栏 -->
	    <div class="Heading BillIcon">
	        <div class="HeadingContent">
	            <h1>业务明细一览表</h1>
	            <span class="Note">查询业务交易的详细清单，双击可以修改业务单，<span style="color:black">黑色</span>表示未审核、<span style="color:blue">蓝色</span>表示已审核、<span style="color:red">红色</span>表示已完工、<span style="color:purple">紫色</span>表示已送完货、<span style="color:green">绿色</span>表示已结清。</span>
	        </div>
	    </div>

		<!-- 主内容 -->
		<div class="Content">
	        <!-- 筛选控件栏 -->
	        <div class="FilterBar ClearFix">
	            <div class="SearchIcon"></div>
	            <span class="fl">
	            	<table class="MoreOption" cellpadding="0" cellspacing="0">
	            		<th class="c1" width="80px">
	            			<input type="checkbox" name="cb_order_date" id="cb_order_date" <c:if test="${cbOrderDate=='1' || searchType=='2'}">checked="true"</c:if> style="visibility:hidden;" />
	            			订货日期
	            		</th>
	            		<td width="360px">
	            			<input type="text" class="TextBox Datetime" maxlength="15" onKeyUp="checkInput();" onFocus="doAutoCheck('cb_order_date');" id="start_date" name="start_date" value="<c:out value="${startDate}" />">
			            	<img src="/images/calendar.gif" class="imgIconButton" onClick="displayCalendar(document.getElementById('start_date'),'yyyy-mm-dd',this,false,'doAutoCheck(\'cb_order_date\')');">
			            	<input type="hidden" id="hid_start_date" value="<c:out value="${startDate}" />">
			            	至
			            	<input type="text" class="TextBox Datetime" maxlength="15" onKeyUp="checkInput();" onFocus="doAutoCheck('cb_order_date');" id="end_date" name="end_date" value="<c:out value="${endDate}" />">
			            	<img src="/images/calendar.gif" class="imgIconButton" onClick="displayCalendar(document.getElementById('end_date'),'yyyy-mm-dd',this,false,'doAutoCheck(\'cb_order_date\')');">
			            	<input type="hidden" id="hid_end_date" value="<c:out value="${endDate}" />">
			            	<a href="javascript:setDate('CURRENT_MONTH');">本月</a>
							<a href="javascript:setDate('TODAY');">今天</a>
							<a href="javascript:setDate('YESTERDAY');">昨天</a>
							<a href="javascript:setDate('PREVIEW_MONTH');">上月</a>
	            		</td>
	            	</table>
	            </span>
	            <span class="fr">
	            	<a href="javascript:;" id="lnkMoreOption">更多查询选项</a>
		  			<input type="button" value=" 查 询" onClick="doSearch();" class="buttom search-but" id="sSearchButton" name="sSearchButton">
	                <input type="button" value=" 导 出" onClick="doDownload();" class="buttom search-out" id="sDownloadButton" name="sDownloadButton" <c:if test="${showCost!='1' || currentUser.user.userType!=1 && fn:indexOf(currentUser.privs,';NO_EXPO;')!=-1}">disabled="true"</c:if>>
	            </span>
				<div id="dvMoreOptionBox" class="MoreOptionBox" style="display:none;">
					<table class="MoreOption" cellpadding="0" cellspacing="0">
						<tr>
							<th class="c1" width="80px">
			        			<input type="checkbox" name="cb_bill_code" id="cb_bill_code" <c:if test="${cbBillCode=='1'}">checked="true"</c:if>>
			        			业务单号
			        		</th>
			        		<td class="c1" width="260px">
			        			<input type="text" class="TextBox" maxlength="50" name="bill_code" id="bill_code" onFocus="doAutoCheck('cb_bill_code');" onKeyUp="checkInput();" value="<c:out value="${billCode}" />">
								<input type="hidden" id="hid_bill_code" value="<c:out value="${billCode}" />">
			    			</td>
	                    	<th class="c2" width="80px">
	                        	<input type="checkbox" name="cb_examine" id="cb_examine" <c:if test="${cbExamine=='1'}">checked="true"</c:if>>
	                        	审核状态
	                        </th>
	                    	<td class="c2" width="250px">
	                        	<input type="radio" name="examined" id="examine1" onClick="doAutoCheck('cb_examine');" <c:if test="${examined==null || examined=='' || examined=='Y'}">checked="true"</c:if>>已审核
	                        	<input type="radio" name="examined" id="examine2" onClick="doAutoCheck('cb_examine');" <c:if test="${examined=='N'}">checked="true"</c:if>>未审核
	                        	<input type="radio" name="examined" id="examine3" onClick="doAutoCheck('cb_examine');" <c:if test="${examined=='A'}">checked="true"</c:if>>全部
	                    	</td>
	                    	<th class="c3" width="80px">
			        			<input type="checkbox" name="cb_mng" id="cb_mng" <c:if test="${cbMng=='1'}">checked="true"</c:if>>
			        			业务员
			        		</th>
			    			<td class="c3" width="180px">
			        			<input type="text" class="TextBox" maxlength="15" name="mng_name" id="mng_name" onKeyUp="checkInput();" onFocus="doAutoCheck('cb_mng');" value="<c:out value="${mngName}" />" >
	                        	<img src="/images/make-a.gif" class="imgIconButton" onClick="selectStafferName('mng_name','cb_mng');" />
	                        	<input type="hidden" id="hid_mng_name" value="<c:out value="${mngName}" />">
			    			</td>
						</tr>
						<tr>
							<th class="c1">
			        			<input type="checkbox" name="cb_est" id="cb_est" <c:if test="${cbEst=='1'}">checked="true"</c:if>>
			        			订货单位
			        		</th>
			    			<td class="c1">
			        			<input type="text" class="TextBox" maxlength="50" name="est_name" id="est_name" onKeyUp="document.getElementById('est_id').value='0';checkInput();" onChange="document.getElementById('est_id').value='0';" onFocus="doAutoCheck('cb_est');" value="<c:out value="${estName}" />">
								<img class="imgIconButton" src="/images/make-a.gif" onClick="selectEstName();" />
								<input type="hidden" id="hid_est_name" value="<c:out value="${estName}" />">
								<input type="hidden" id="est_id" value="${estId}">
			    			</td>
							<th class="c2">
	                        	<input type="checkbox" name="cb_complete" id="cb_complete" <c:if test="${cbComplete=='1'}">checked="true"</c:if>>
	                        	完工状态
	                        </th>
	                    	<td class="c2">
	                        	<input type="radio" name="completed" id="complete1" onClick="doAutoCheck('cb_complete');" <c:if test="${completed==null || completed=='' || completed=='Y'}">checked="true"</c:if>>已完工
	                        	<input type="radio" name="completed" id="complete2" onClick="doAutoCheck('cb_complete');" <c:if test="${completed=='N'}">checked="true"</c:if>>未完工
	                        	<input type="radio" name="completed" id="complete3" onClick="doAutoCheck('cb_complete');" <c:if test="${completed=='A'}">checked="true"</c:if>>全部
			    			</td>
			    			<th class="c3">
			        			<input type="checkbox" name="cb_desi" id="cb_desi" <c:if test="${cbDesi=='1'}">checked="true"</c:if>>
			        			设计员
			        		</th>
			    			<td class="c3">
			        			<input type="text" class="TextBox" maxlength="15" name="desi_name" id="desi_name" onKeyUp="checkInput();" onFocus="doAutoCheck('cb_desi');" value="<c:out value="${desiName}" />" >
	                        	<img src="/images/make-a.gif" class="imgIconButton" onClick="selectStafferName('desi_name','cb_desi');" />
	                        	<input type="hidden" id="hid_desi_name" value="<c:out value="${desiName}" />">
			    			</td>
			    		</tr>
						<tr>
							<th class="c1">
			        			<input type="checkbox" name="cb_linkman" id="cb_linkman" <c:if test="${cbLinkman=='1'}">checked="true"</c:if>>
			        			联系人
			        		</th>
			    			<td class="c1">
			        			<input type="text" class="TextBox" maxlength="50" name="linkman" id="linkman" onFocus="doAutoCheck('cb_linkman');" onKeyUp="checkInput();" value="<c:out value="${linkman}" />">
								<input type="hidden" id="hid_linkman" value="<c:out value="${linkman}" />">
							</td>
	                    	<th class="c2">
	                        	<input type="checkbox" name="cb_deliver" id="cb_deliver" <c:if test="${cbDeliver=='1'}">checked="true"</c:if>>
	                        	送货状态
	                        </th>
	                    	<td class="c2">
	                        	<input type="radio" name="deliver" id="deliver1" onClick="doAutoCheck('cb_deliver');" <c:if test="${delivered==null || delivered=='' || delivered=='Y'}">checked="true"</c:if> >已送完
	                        	<input type="radio" name="deliver" id="deliver2" onClick="doAutoCheck('cb_deliver');" <c:if test="${delivered=='P'}">checked="true"</c:if> >未送完
	                        	<input type="radio" name="deliver" id="deliver3" onClick="doAutoCheck('cb_deliver');" <c:if test="${delivered=='N'}">checked="true"</c:if> >未送货
	                        	<input type="radio" name="deliver" id="deliver4" onClick="doAutoCheck('cb_deliver');" <c:if test="${delivered=='A'}">checked="true"</c:if> >全部
			    			</td>
			    			<th class="c3">
			        			<input type="checkbox" name="cb_foll" id="cb_foll" <c:if test="${cbFoll=='1'}">checked="true"</c:if>>
			        			跟单员
			        		</th>
			    			<td class="c3">
			        			<input type="text" class="TextBox" maxlength="15" name="foll_name" id="foll_name" onKeyUp="checkInput();" onFocus="doAutoCheck('cb_foll');" value="<c:out value="${follName}" />" >
	                        	<img src="/images/make-a.gif" class="imgIconButton" onClick="selectStafferName('foll_name','cb_foll');" />
	                        	<input type="hidden" id="hid_foll_name" value="<c:out value="${follName}" />">
			    			</td>
						</tr>
			    		<tr>
			    			<th class="c1">
			        			<input type="checkbox" name="cb_phone" id="cb_phone" <c:if test="${cbPhone=='1'}">checked="true"</c:if>>
			        			电话
			        		</th>
			    			<td class="c1">
			        			<input type="text" class="TextBox" maxlength="50" name="phone" id="phone" onFocus="doAutoCheck('cb_phone');" onKeyUp="checkInput();" value="<c:out value="${phone}" />">
								<input type="hidden" id="hid_phone" value="<c:out value="${phone}" />">
			    			</td>
			    			<th class="c2">
	                        	<input type="checkbox" name="cb_coll" id="cb_coll" <c:if test="${cbColl=='1'}">checked="true"</c:if>>
	                        	收款状态
	                        </th>
	                    	<td class="c2">
		                        <input type="radio" name="coll" id="coll1" onClick="doAutoCheck('cb_coll');" <c:if test="${coll=='Y'}">checked="true"</c:if>>已收完
		                        <input type="radio" name="coll" id="coll2" onClick="doAutoCheck('cb_coll');" <c:if test="${coll=='N'}">checked="true"</c:if>>未收完
		                        <input type="radio" name="coll" id="coll3" onClick="doAutoCheck('cb_coll');" <c:if test="${coll==null || coll=='' || coll=='A'}">checked="true"</c:if>>全部
			    			</td>
			    			<th class="c3">
			        			<input type="checkbox" name="cb_intr" id="cb_intr" <c:if test="${cbIntr=='1'}">checked="true"</c:if>>
			        			业务来源
			        		</th>
			    			<td class="c3">
			        			<input type="text" class="TextBox" maxlength="15" name="intr_name" id="intr_name" onKeyUp="checkInput();" onFocus="doAutoCheck('cb_intr');" value="<c:out value="${intrName}" />" >
	                        	<img src="/images/make-a.gif" class="imgIconButton" onClick="selectStafferName('intr_name','cb_intr');" />
	                        	<input type="hidden" id="hid_intr_name" value="<c:out value="${intrName}" />">
	                    	</td>
			    		</tr>
			    		<tr>
			    			<th class="c1">
	                        	<input type="checkbox" name="cb_del_date" id="cb_del_date" <c:if test="${cbDelDate=='1'}">checked="true"</c:if>>
	                        	交货日期
	                        </th>
	                        <td>
	                        	<input type="text" class="TextBox Datetime" maxlength="15" onKeyUp="checkInput();" onFocus="doAutoCheck('cb_del_date');" id="del_start" name="del_start" value="<c:out value="${delStart}" />">
	                        	<img src="/images/calendar.gif" class="imgIconButton" onClick="displayCalendar(document.getElementById('del_start'),'yyyy-mm-dd',this,false,'doAutoCheck(\'cb_del_date\')');">
	                        	<input type="hidden" id="hid_del_start" value="<c:out value="${delStart}" />">
	                        	至
	                        	<input type="text" class="TextBox Datetime" maxlength="15" onKeyUp="checkInput();" onFocus="doAutoCheck('cb_del_date');" id="del_end" name="del_end" value="<c:out value="${delEnd}" />">
	                        	<img src="/images/calendar.gif" class="imgIconButton" onClick="displayCalendar(document.getElementById('del_end'),'yyyy-mm-dd',this,false,'doAutoCheck(\'cb_del_date\')');">
	                        	<input type="hidden" id="hid_del_end" value="<c:out value="${delEnd}" />">
	                    	</td>
			    			<th class="c2">
	                        	<input type="checkbox" name="cb_close" id="cb_close" <c:if test="${cbClose=='1'}">checked="true"</c:if>>
	                        	结清状态
	                        </th>
	                    	<td class="c2">
		                        <input type="radio" name="closed" id="close1" onClick="doAutoCheck('cb_close');" <c:if test="${closed=='Y'}">checked="true"</c:if>>已结清
		                        <input type="radio" name="closed" id="close2" onClick="doAutoCheck('cb_close');" <c:if test="${closed==null || closed=='' || closed=='N'}">checked="true"</c:if>>未结清
		                        <input type="radio" name="closed" id="close3" onClick="doAutoCheck('cb_close');" <c:if test="${closed=='A'}">checked="true"</c:if>>全部
			    			</td>
			        		<th class="c3">
			        			<input type="checkbox" name="cb_crea" id="cb_crea" <c:if test="${cbCrea=='1'}">checked="true"</c:if>>
			        			开单人
			        		</th>
			    			<td class="c3">
			        			<input type="text" class="TextBox" maxlength="15" name="crea_name" id="crea_name" onKeyUp="checkInput();" onFocus="doAutoCheck('cb_crea');" value="<c:out value="${creaName}" />">
								<img class="imgIconButton" src="/images/make-a.gif" onClick="selectStafferName('crea_name','cb_crea');" />
								<input type="hidden" id="hid_crea_name" value="<c:out value="${creaName}" />">
			    			</td>
			    		</tr>
			    		<tr>
			    			<th class="c1">
			        			<input type="checkbox" name="cb_cont_code" id="cb_cont_code" <c:if test="${cbContCode=='1'}">checked="true"</c:if>>
			        			合同号
			        		</th>
			    			<td class="c1">
			        			<input type="text" class="TextBox" maxlength="50" name="cont_code" id="cont_code" onKeyUp="checkInput();" onFocus="doAutoCheck('cb_cont_code');" value="<c:out value="${contCode}" />" >
								<input type="hidden" id="hid_cont_code" value="<c:out value="${contCode}" />">
							</td>
							<th class="c2">
	                        	<input type="checkbox" name="cb_coop" id="cb_coop" <c:if test="${cbCoop=='1'}">checked="true"</c:if>>
	                        	是否外协
	                        </th>
	                    	<td class="c2">
		                        <input type="radio" name="cooper" id="cooper1" onClick="doAutoCheck('cb_coop');" <c:if test="${coop=='Y'}">checked="true"</c:if>>是
		                        <input type="radio" name="cooper" id="cooper2" onClick="doAutoCheck('cb_coop');" <c:if test="${coop=='N'}">checked="true"</c:if>>否
		                        <input type="radio" name="cooper" id="cooper3" onClick="doAutoCheck('cb_coop');" <c:if test="${coop==null || coop=='' || coop=='A'}">checked="true"</c:if>>全部
			    			</td>
			        		<th class="c3">
			        			<input type="checkbox" name="cb_dep" id="cb_dep" <c:if test="${cbDep=='1'}">checked="true"</c:if>>
			        			部门
			        		</th>
			    			<td class="c3">
			        			<select name="department" id="department" onFocus="doAutoCheck('cb_dep');">
	                            	<option value="0">==请选择==</option>
	                            	<commonTag:createSelectTree list="${depList}" emptyOption="0" justEnabled="1" defaultValue="${department}" />
	                        	</select>
	                        </td>
			    		</tr>
			    		<tr>
			    			<th class="c1">
			        			<input type="checkbox" name="cb_bb_cont" id="cb_bb_cont" <c:if test="${cbBbCont=='1'}">checked="true"</c:if>>
			        			摘要
			        		</th>
			    			<td class="c1">
			        			<input type="text" class="TextBox" maxlength="50" name="bb_cont" id="bb_cont" onKeyUp="checkInput();" onFocus="doAutoCheck('cb_bb_cont');" value="${bbCont}" >
								<input type="hidden" id="hid_bb_cont" value="<c:out value="${bbCont}" />">
			    			</td>
			    			<th class="c2">
			        			<input type="checkbox" name="cb_make_type" id="cb_make_type" <c:if test="${cbMakeType=='1'}">checked="true"</c:if>>
	                        	项目类型
			        		</th>
			    			<td class="c2">
			        			<select name="make_type" id="make_type" onFocus="doAutoCheck('cb_make_type');">
									<option value="0">==请选择==</option>
									<commonTag:createSelectTree list="${mtList}" emptyOption="0" justEnabled="1" defaultValue="${makeType}" />
								</select>
			        		</td>
			        		<th class="c3">
			        			<input type="checkbox" name="cb_area" id="cb_area" <c:if test="${cbArea=='1'}">checked="true"</c:if>>
			        			地区
			        		</th>
			    			<td class="c3">
			    				<select name="area" id="area" onFocus="doAutoCheck('cb_area');">
									<option value="0">==请选择==</option>
									<commonTag:createSelectTree list="${areaList}" emptyOption="0" justEnabled="1" defaultValue="${area}" />
								</select>
	                        </td>
			    		</tr>
			    		<tr>
			    			<th class="c1">
			        			<input type="checkbox" name="cb_cost" id="cb_cost" <c:if test="${cbCost=='1'}">checked="true"</c:if>>
			        			订货金额
			        		</th>
			    			<td>
			        			<input type="text" class="TextBox Money" maxlength="15" onKeyUp="checkInput();" onFocus="doAutoCheck('cb_cost');" id="min_cost" name="min_cost" value="${minCost}">
								至
								<input type="text" class="TextBox Money" maxlength="15" onKeyUp="checkInput();" onFocus="doAutoCheck('cb_cost');" id="max_cost" name="max_cost" value="${maxCost}">
								<input type="hidden" id="hid_min_cost" value="<c:out value="${minCost}" />">
								<input type="hidden" id="hid_max_cost" value="<c:out value="${maxCost}" />">
			    			</td>
			        		<th class="c2">
			        			<input type="checkbox" name="cb_product" id="cb_product" <c:if test="${cbProduct=='1'}">checked="true"</c:if>>
	                        	材质
			        		</th>
			    			<td class="c2">
			        			<input type="text" class="TextBox" maxlength="50" name="product" id="product" onKeyUp="checkInput();" onFocus="doAutoCheck('cb_product');" value="<c:out value="${product}" />">
								<input type="hidden" id="hid_product" value="<c:out value="${product}" />">
			        		</td>
			        		<th class="c3">
			        			<input type="checkbox" name="cb_est_type" id="cb_est_type" <c:if test="${cbEstType=='1'}">checked="true"</c:if>>
			        			客户类别
			        		</th>
			    			<td class="c3">
			        			<select name="est_type" id="est_type" onFocus="doAutoCheck('cb_est_type');">
					  				<option value="0">==请选择==</option>
					  				<c:forEach var="item" items="${etList}">
					  				<c:if test="${item.enabled=='Y'}"><option value="${item.id}" <c:if test="${estType==item.id}">selected</c:if>>${item.typeName}</option></c:if>
					  				</c:forEach>
				  				</select>
	                        </td>
			    		</tr>
			    		<tr>
			    			<th class="c1">
			        			<input type="checkbox" name="cb_pric" id="cb_pric" <c:if test="${cbPric=='1'}">checked="true"</c:if>>
	                        	单价
			        		</th>
			    			<td class="c1">
			        			<input type="radio" name="pric" id="pric1" onClick="doAutoCheck('cb_pric');" <c:if test="${pric=='NOT_ZERO'}">checked="true"</c:if>>不为0
		                        <input type="radio" name="pric" id="pric2" onClick="doAutoCheck('cb_pric');" <c:if test="${pric=='ZERO'}">checked="true"</c:if>>为0
		                        <input type="radio" name="pric" id="pric3" onClick="doAutoCheck('cb_pric');" <c:if test="${pric==null || pric=='' || pric=='A'}">checked="true"</c:if>>全部
			        		</td>
			        		<th class="c2">
			        			<input type="checkbox" name="cb_content" id="cb_content" <c:if test="${cbContent=='1'}">checked="true"</c:if>>
	                        	内容
			        		</th>
			    			<td class="c2">
			        			<input type="text" class="TextBox" maxlength="50" name="content" id="content" onKeyUp="checkInput();" onFocus="doAutoCheck('cb_content');" value="<c:out value="${content}" />">
								<input type="hidden" id="hid_content" value="<c:out value="${content}" />">
			        		</td>
			        		<th class="c3">
			        			<input type="checkbox" name="cb_est_level" id="cb_est_level" <c:if test="${cbEstLevel=='1'}">checked="true"</c:if>>
			        			客户等级
			        		</th>
			    			<td class="c3">
			        			<select name="est_level" id="est_level" onFocus="doAutoCheck('cb_est_level');">
					  				<option value="0">==请选择==</option>
					  				<c:forEach var="item" items="${elList}">
					  				<c:if test="${item.enabled=='Y'}"><option value="${item.id}" <c:if test="${estLevel==item.id}">selected</c:if>>${item.levelName}</option></c:if>
					  				</c:forEach>
				  				</select>
	                        </td>
			    		</tr>
			    		<tr>
			    			<th class="c1">
			        			<input type="checkbox" name="cb_ts" id="cb_ts" <c:if test="${cbTs=='1'}">checked="true"</c:if>>
	                        	账套
			        		</th>
			    			<td class="c1">
			        			<select name="ts_id" id="ts_id" onFocus="doAutoCheck('cb_ts');">
				    				<option value="0">==请选择账套==</option>
				    				<c:forEach var="item" items="${tsList}">
									<option value="${item.id}" <c:if test="${tsId==item.id}">selected</c:if>>${item.title}</option>
									</c:forEach>
								</select>
			        		</td>
			        		<th class="c2">
			        			<input type="checkbox" name="cb_require" id="cb_require" <c:if test="${cbRequire=='1'}">checked="true"</c:if>>
	                        	制作要求
			        		</th>
			    			<td class="c2">
			        			<input type="text" class="TextBox" maxlength="50" name="require" id="require" onKeyUp="checkInput();" onFocus="doAutoCheck('cb_require');" value="<c:out value="${require}" />">
								<input type="hidden" id="hid_require" value="<c:out value="${require}" />">
			        		</td>
			        		<th class="c3">
			        			<input type="checkbox" name="cb_wc" id="cb_wc" <c:if test="${cbWc=='1'}">checked="true"</c:if>>
	                        	工作中心
			        		</th>
			        		<td class="c3">
			        			<select name="wc" id="wc" onFocus="doAutoCheck('cb_wc');" onChange="doWcChange();">
					  				<option value="0">==请选择==</option>
					  				<c:forEach var="item" items="${myWcList}">
					  				<option value="${item.id}" <c:if test="${wc==item.id}">selected</c:if>>${item.wcName}</option>
					  				</c:forEach>
				  				</select>
			        		</td>
			    		</tr>
			    		<tr>
			    			<th class="c1">&nbsp;</th>
			    			<td class="c1">&nbsp;</td>
			        		<th class="c2">
	                        	<input type="checkbox" name="cb_pr" id="cb_pr" <c:if test="${cbPr=='1'}">checked="true"</c:if>>
	                        	计价类型
	                        </th>
	                    	<td class="c2">
		                        <input type="radio" name="pr" id="pr1" onClick="doAutoCheck('cb_pr');" <c:if test="${pr=='AREA'}">checked="true"</c:if>>平方
		                        <input type="radio" name="pr" id="pr2" onClick="doAutoCheck('cb_pr');" <c:if test="${pr=='LENGTH'}">checked="true"</c:if>>长度
		                        <input type="radio" name="pr" id="pr3" onClick="doAutoCheck('cb_pr');" <c:if test="${pr=='AMOUNT'}">checked="true"</c:if>>成品
		                        <input type="radio" name="pr" id="pr4" onClick="doAutoCheck('cb_pr');" <c:if test="${pr==null || pr=='' || pr=='A'}">checked="true"</c:if>>全部
			    			</td>
			    			<th class="c3">
			        			<input type="checkbox" name="cb_wp" id="cb_wp" <c:if test="${cbWp=='1'}">checked="true"</c:if>>
	                        	生产进度
			        		</th>
			    			<td class="c3">
			        			<select name="wp" id="wp" onFocus="doAutoCheck('cb_wp');">
				    				<option value="0">==请选择==</option>
				    				<c:forEach var="item" items="${proList}">
									<c:if test="${item.workCenterId==wc && item.enabled=='Y'}"><option value="${item.id}" <c:if test="${wp==item.id}">selected</c:if>>${item.processName}</option></c:if>
									</c:forEach>
								</select>
			        		</td>
			    		</tr>
			    	</table>
			    	<div class="OptionOrderBy">
	                	<input type="checkbox" name="cb_order" id="cb_order" <c:if test="${cbOrder=='1'}">checked="true"</c:if>>
	                    	排序类型
	                    <select name="order_by" id="order_by" onFocus="doAutoCheck('cb_order');">
	                        <option value="">==请选择==</option>
						  	<option value="ORDER_DATE" <c:if test="${orderBy=='ORDER_DATE'}">selected</c:if>>订货日期</option>
						  	<option value="DELIVER_DATE" <c:if test="${orderBy=='DELIVER_DATE'}">selected</c:if>>交货日期</option>
						  	<option value="COST" <c:if test="${orderBy=='COST'}">selected</c:if>>金额</option>
						  	<option value="BILL_CODE" <c:if test="${orderBy=='BILL_CODE'}">selected</c:if>>单号</option>
						  	<option value="CONTENT" <c:if test="${orderBy=='CONTENT'}">selected</c:if>>摘要</option>
						  	<option value="EST_NAME" <c:if test="${orderBy=='EST_NAME'}">selected</c:if>>订货单位</option>
	                    </select>
	                    <select name="order_sc" id="order_sc" onFocus="doAutoCheck('cb_order');">
	                        <option value="ASC" <c:if test="${orderSc=='ASC'}">selected</c:if>>升序</option>
	                        <option value="DESC" <c:if test="${orderSc=='DESC'}">selected</c:if>>降序</option>
	                    </select>
	                    <span class="fr"><a href="javascript:;" id="lnkHiddenOption">隐藏查询选项</a></span>
	                </div>
			    </div>
			</div>
			
			<!-- 提示信息显示栏 -->
	        <div class="MsgBar">
	            <%@include file="../inc/AlertMsg.jsp"%>
	        </div>
			
			<!-- 上栏 分页、操作等 -->
	        <div class="TopToolBar">
	            <table class="ListNoteInfo" cellpadding="0" cellspacing="0">
	            	<tr>
	                	<td>
	                		选择：
	                		<a href="javascript:showList('ZERO_PRIC');">零单价</a>
	                		<c:if test="${currentUser.user.userType==1 || fn:indexOf(currentUser.privs,';NO_TOTA;')==-1}">
							<c:if test="${showCost=='1'}"><span>金额合计（未扣除优惠）：${costTotal}元</span>&nbsp;&nbsp;</c:if>
							<span>面积合计：${squareTotal}平方米</span>&nbsp;&nbsp;
							<span>长度合计：${lengMTotal}米&nbsp;${lengCmTotal}公分</span>&nbsp;&nbsp;
							<span>成品数量合计：${amountTotal}</span>&nbsp;&nbsp;
							<span>合同单数：${billTotal}笔</span>
							</c:if>
	                	</td>
	            	</tr>
	            </table>
			</div>
			
			<div class="table-list">
	        	<table style="width:2910px;">
	          		<tr>
					  	<th  style="width:110px;">单号</th>
						<th  style="width:70px;">订货日期</th>
						<th  style="width:130px;">订货单位</th>
						<th  style="width:80px;">项目类型</th>
						<th  style="width:110px;">内容</th>
						<th  style="width:100px;">材质</th>
						<th  style="width:130px;">规格</th>
						<th  style="width:50px;">单位</th>
						<th  style="width:50px;">数量</th>
						<th  style="width:50px;">单价</th>
						<th  style="width:60px;">金额</th>
						<th  style="width:140px;">制作要求</th>
						<th  style="width:100px;">生产进度</th>
						<th  style="width:60px;">业务员</th>
						<th  style="width:130px;">设计员</th>
						<th  style="width:60px;">跟单员</th>
						<th  style="width:60px;">业务来源</th>
						<th  style="width:60px;">开单人</th>
						<th  style="width:70px;">部门</th>
						<th  style="width:70px;">工作中心</th>
						<th  style="width:60px;">是否外协</th>
						<th  style="width:60px;">地区</th>
						<th  style="width:80px;">客户类别</th>
						<th  style="width:60px;">客户等级</th>
						<th  style="width:100px;">摘要</th>
						<th  style="width:60px;">联系人</th>
						<th  style="width:100px;">电话</th>
						<th  style="width:200px;">地址</th>
						<th  style="width:70px;">交货日期</th>
						<th  style="width:100px;">合同号</th>
						<th  style="width:100px;">银行账户</th>
			  		</tr>
					<c:forEach var="item" items="${qr.list}" varStatus="i">
					<c:if test="${(i.index mod 2)==0}"><c:set var="trClass" value="query_list_data_tr1" /></c:if>
					<c:if test="${(i.index mod 2)!=0}"><c:set var="trClass" value="query_list_data_tr2" /></c:if>
					<c:set var="defaultFontColor" value="black" />
					<c:if test="${item[3]=='Y'}"><c:set var="defaultFontColor" value="blue" /></c:if>
					<c:if test="${item[2].wcId==0 && item[2].isCooper=='N' || (item[2].wcId!=0 && item[2].isCooper=='N' && item[6]=='Y') || (item[2].wcId==0 && item[2].isCooper=='Y' && item[11]=='Y') || (item[2].wcId!=0 && item[2].isCooper=='Y' && item[6]=='Y' && item[11]=='Y')}"><c:set var="defaultFontColor" value="red" /></c:if>
					<c:if test="${item[5]-item[2].amount==0.00}"><c:set var="defaultFontColor" value="purple" /></c:if>
					<c:if test="${item[4]=='Y'}"><c:set var="defaultFontColor" value="green" /></c:if>
					<tr class="${trClass}" style="color:${defaultFontColor};cursor:pointer;" defaultFontColor="${defaultFontColor}" index="${i.index+1}" onClick='javascript:ClickCheck(this)' ondblclick='javascript:DoubleClick(${item[0].id})' onmouseout='javascript:mouseout(this)' onmouseover='javascript:mouseover(this)'>
						<td>
							<input type="radio" name='query_checkbox' value="${item[0].id}" style="display:none">
							${item[0].billCode}
						</td>
						<td><fmt:formatDate value="${item[0].orderDate}" pattern="yyyy-MM-dd"/></td>
						<td>${item[1]}</td>
						<td><commonTag:showSimpleObjectName list="${mtList}" objectId="${item[2].makeTypeId}" /></td>
						<td><commonTag:parseEnterToBr source="${item[2].finishedContent}" /></td>
						<td>${item[2].proName}</td>
						<td>
							<commonTag:parseEnterToBr source="${item[2].specification}" />
							<c:if test="${item[2].priceType=='AREA' || item[2].priceType=='LENGTH'}"> x <commonTag:parseBigDecimal source="${item[2].amount}" /></c:if>
						</td>
						<td>
							<c:if test="${item[2].priceType=='AREA'}">平方米</c:if>
							<c:if test="${item[2].priceType=='LENGTH'}">
								<c:if test="${item[2].lengType=='M'}">米</c:if><c:if test="${item[2].lengType=='CM'}">公分</c:if>
							</c:if>
							<c:if test="${item[2].priceType=='AMOUNT'}">${item[2].unit}</c:if>
						</td>
						<td>
							<c:if test="${item[2].priceType=='AREA' || item[2].priceType=='LENGTH'}"><commonTag:parseBigDecimal source="${item[2].squareNum}" /></c:if>
							<c:if test="${item[2].priceType=='AMOUNT'}"><commonTag:parseBigDecimal source="${item[2].amount}" /></c:if>
						</td>
						<td><c:if test="${showCost=='1'}"><commonTag:parseBigDecimal source="${item[2].unitPrice}" /></c:if></td>
						<td><c:if test="${showCost=='1'}"><commonTag:parseBigDecimal source="${item[2].cost}" /></c:if></td>
						<td><commonTag:parseEnterToBr source="${item[2].makeRequire}" /></td>
						<td><commonTag:showSimpleObjectName list="${proList}" objectId="${item[12]}" /></td>
						<td>${item[0].managerName}</td>
						<td>${item[0].designerNameStr}</td>
						<td>${item[0].followerNameStr}</td>
						<td>${item[0].introducerName}</td>
						<td>${item[0].createrName}</td>
						<td><commonTag:showSimpleObjectName list="${depList}" objectId="${item[0].departmentId}" /></td>
						<td><commonTag:showSimpleObjectName list="${wcList}" objectId="${item[2].wcId}" /></td>
						<td>
							<c:if test="${item[2].isCoop=='Y'}">是</c:if>
							<c:if test="${item[2].isCoop=='N'}">否</c:if>
						</td>
						<td><commonTag:showSimpleObjectName list="${areaList}" objectId="${item[8]}" /></td>
						<td><commonTag:showSimpleObjectName list="${etList}" objectId="${item[9]}" /></td>
						<td><commonTag:showSimpleObjectName list="${elList}" objectId="${item[10]}" /></td>
						<td>${item[0].content}</td>
						<td>${item[0].linkman}</td>
						<td>${item[0].phone}</td>
						<td>${item[0].address}</td>
						<td><c:if test="${item[0].deliverDate!=null}"><fmt:formatDate value="${item[0].deliverDate}" pattern="yyyy-MM-dd"/></c:if></td>
						<td>${item[0].contractCode}</td>
						<td>${item[13]}</td>
					</tr>
					</c:forEach>
				</table>
			</div>
	
			<!-- 底栏 分页、操作等 -->
	        <div class="BottomToolBar ClearFix">
			    <%@include file="../inc/Pages.jsp"%>
	        </div>
			
		</div>
	</div>
</div>
</body>
</html>
<script type="text/javascript">
	function ChangeWindowSize( container, maxWidth ){
	    setTimeout( function(){
	        var w1 = document.documentElement.clientWidth-40;
	        if( w1>maxWidth ) w1 = maxWidth;
	        else if( w1<970 ) w1 = 960;
	        container.style.width = w1+'px';
	    }, 300 );
	}
	var IsAdvSearch = false;
	(function(){
		doInit();
	    var ListContainer = document.getElementById('ListContainer');
	    ChangeWindowSize( ListContainer, 2020 );    // 超过 1280 的最大 1260 ，不全部铺满
	
	    var lnkMoreOption   = document.getElementById('lnkMoreOption');
	    var lnkHiddenOption = document.getElementById('lnkHiddenOption');
	    lnkMoreOption.onclick = function(){
	    	IsAdvSearch = true;
	        document.getElementById('dvMoreOptionBox').style.display = 'block';
	        document.getElementById('cb_order_date').style.visibility = 'visible';
	        this.style.visibility = 'hidden';
	    };
	    lnkHiddenOption.onclick = function(){
	    	IsAdvSearch = false;
	        document.getElementById('dvMoreOptionBox').style.display = 'none';
	        document.getElementById('cb_order_date').style.visibility = 'hidden';
	        lnkMoreOption.style.visibility = 'visible';
	    };
	})();
</script>
